using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Text;
using System.Windows.Forms;

namespace ANGF
{
    public partial class FormReport : Form
    {
        private string text;
        public FormReport(string text)
        {
            InitializeComponent();
            this.text = text;
        }

        private void FormReport_Load(object sender, EventArgs e)
        {
            this.textBoxText.Text = text;
        }

        private void textBoxText_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 0x01) this.textBoxText.SelectAll();
        }

        private void buttonSaveAs_Click(object sender, EventArgs e)
        {
            saveFileDialog.FileName = "report" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".txt";
            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    File.WriteAllText(saveFileDialog.FileName, this.textBoxText.Text, Encoding.Default);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this, ex.ToString(), "Save Error");
                }
            }
        }
    }
}